package jp.michi.makimono;

public class Cache {
    //    public static String CACHE_PATH = ".mipmapcache";
    //    public static SQLiteDatabase sDatabase;
    //    public static SQLiteDatabase database(String imageFolder) {
    //        if (sDatabase == null) {
    //            sDatabase = SQLiteDatabase.openOrCreateDatabase(imageFolder + "/" + CACHE_PATH + "/" + "cache.db", null);
    //        }
    //        return sDatabase;
    //    }
    //    public static void closeDatabase() {
    //        if (sDatabase != null) {
    //            sDatabase.close();
    //            sDatabase = null;
    //        }
    //    }
    //    public static int[] readSize(File imageFile) throws IOException {
    //        File file = new File(imageFile.getParentFile(), CACHE_PATH + "/" + imageFile.getName() + "/size");
    //        Log.v("readSize", file.getAbsolutePath());
    //        if (!file.exists()) {
    //            return null;
    //        }
    //        FileReader reader = null;
    //        try {
    //            reader = new FileReader(file);
    //            StringBuilder builder = new StringBuilder(100);
    //            char[] buffer = new char[100];
    //            for (int count = -1; (count = reader.read(buffer)) != -1;) {
    //                builder.append(buffer, 0, count);
    //            }
    //            String[] s = builder.toString().split("x");
    //            return new int[] {Integer.valueOf(s[0]).intValue(), Integer.valueOf(s[1]).intValue()};
    //        } finally {
    //            Util.close(reader);
    //        }
    //    }
    //    public static void writeSize(File imageFile, int width, int height) throws IOException {
    //        File file = new File(imageFile.getParentFile(), CACHE_PATH + "/" + imageFile.getName() + "/size");
    //        prepare(file);
    //        FileWriter writer = null;
    //        try {
    //            writer = new FileWriter(file);
    //            writer.write(width + "x" + height);
    //            writer.flush();
    //        } finally {
    //            Util.close(writer);
    //        }
    //    }
    //    public static void prepare(File file) throws IOException {
    //        file.getParentFile().mkdirs();
    //        file.createNewFile();
    //    }
}
